﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Demo
{
    public partial class Timer : Form
    {
        public Timer()
        {
            InitializeComponent();
        }

        private int i = 10;
        private void countButton_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void Timer_Load(object sender, EventArgs e)
        {
            label1.Text = i.ToString();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (i > 0)
                label1.Text = (--i).ToString();

            if (i == 0)
            {
                MessageBox.Show("Hi, everone");
                timer1.Stop();
            }
        }
    }
}
